$('#tickets').html("<%= escape_javascript(render 'admin/topics/new_ticket') %>");
// $('#ticket-page-title').html("<%= "#{t(:open_new_discussion, default: 'New Discussion')}" %>:").show();
$(document).prop('title', "<%= admin_title %> <%= "#{t(:open_new_discussion, default: 'New Discussion')}" %>");
history.pushState(null, null, '<%= new_admin_topic_path %>');

// Hook validations
$('#new_topic').enableClientSideValidations();

// Empty ticket search field and hide
$('q').val('');

// Update timestamps
$('.last-active time[data-time-ago]').timeago();

// Send ping to GA
ga('send', 'pageview');

// jQuery hook
Helpy.ready();
Helpy.track();
Helpy.logHistory();
Helpy.ticketMenu();

// escape from fields
newtopic = document.getElementById('new_topic');
Mousetrap(newtopic).bind('escape', function(e, combo) {
  $('#topic_user_email, #topic_user_name, #topic_name, #topic_post_body').blur();
});

// RTL changes?
<%= "Helpy.rtl();" if rtl? %>
